package com.ly.HashMap;

import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class HashTest01 {
    public static void main(String[] args) {
        Map<String, Object> hashMap = new HashMap<>();

        hashMap.put("a", "1");
        hashMap.put("b", "2");
        hashMap.put("c", "3");
        hashMap.put("d", "4");

        /*for (String key:
             hashMap.keySet()) {
            System.out.println("value"+hashMap.get(key));
        }*/

       /* for (Map.Entry entry:
             hashMap.entrySet()) {
            System.out.println("key"+entry.getKey()+"=="+entry.getValue());
        }*/

        Iterator<Map.Entry<String, Object>> iterator = hashMap.entrySet().iterator();
        while (iterator.hasNext()) {
            Map.Entry<String, Object> next = iterator.next();
            System.out.println(next.getKey() + "==" + next.getValue());
        }

        Map<String, Object> map = Collections.synchronizedMap(hashMap);


    }
}
